<template>
  <div class="nav-bar">
    {{title}}
  </div>
</template>

<script>
export default {
  name: 'NavBar',

  data () {
    return {
      title: '首页'
    }
  },
  watch: {
    // $route (newVal, oldVal) {
    //   console.log(newVal)
    //   this.title = newVal.meta.title
    // }
    $route: {
      handler: function (newVal) {
        this.title = newVal.meta.title
      },
      immediate: true
    }
  }
}
</script>

<style lang="less" scoped>
  .nav-bar {
    height: 36px;
    line-height: 36px;
    border-bottom: 1px solid #eaeaea;
    text-align: center;
    background:cornflowerblue;
    color: #FAFAFA;
    font-size: 16px;
    font-weight: 700;

  }
</style>
